﻿@model ItemControllerModel.Index
<div>
    <div class="ui-box  ui-box-alpha">
        <div class="ui-box-head">
            <div class="ui-box-head-border">
                <div class="ui-box-head-title">
                    商品管理
                </div>
                <a href="#" class="ui-box-head-more">去购物</a>
            </div>
        </div>
        <div class="ui-box-container">
            <div class="ui-box-content">
                @using (Html.BeginForm("index", "item", FormMethod.Get, new { @class = "form-horizontal", role = "form" }))
                {
                    <div class="form-group">
                        <label for="keyword" class="col-md-2 control-label">
                            商品Id/名称</label>
                        <div class="col-md-2">
                            <input type="text" id="keyword" name="keyword" class="form-control" maxlength="25"   value="@(Model.Keyword)" />
                        </div>
                        <label for="outerId" class="col-md-2 control-label">
                            商家编码</label>
                        <div class="col-md-2">
                            <input type="text" id="outerId" name="outerId" class="form-control" maxlength="20"  value="@(Model.OuterId)" />
                        </div>
                        <label for="categoryRootId" class="col-md-2 control-label">
                            一级类目</label>
                        <div class="col-md-2">
                            <select id="categoryRootId" name="categoryRootId" class="form-control">
                                <option value="0">全部类目</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="priceFrom" class="col-md-2 control-label">
                            商品价格</label>
                        <div class="col-md-2">
                            <input type="text" id="priceFrom" name="priceFrom" class="form-control" style="display: inline;width: 53px;" maxlength="10" value="@(Model.PriceFrom.HasValue ? Model.PriceFrom.Value.ToString("N") : string.Empty)"/>
                            <span>至</span>
                            <input type="text" name="priceTo" class="form-control" style="display: inline;width: 53px;" maxlength="10" value="@(Model.PriceTo.HasValue ? Model.PriceTo.Value.ToString("N") : string.Empty)"/>
                        </div>
                        <label for="saleFrom" class="col-md-2 control-label">
                            总销售量</label>
                        <div class="col-md-2">
                            <input type="text" id="saleFrom" name="saleFrom" class="form-control" style="display: inline;width: 53px;" maxlength="5" value="@(Model.SaleFrom.HasValue ? Model.SaleFrom.Value.ToString() : string.Empty)"/>
                            <span>至</span>
                            <input type="text" name="saleTo" class="form-control" style="display: inline;width: 53px;" maxlength="5" value="@(Model.SaleTo.HasValue ? Model.SaleTo.Value.ToString() : string.Empty)"/>
                        </div>
                        <div class="col-md-offset-1 col-md-3">
                            <button type="submit" class="btn btn-default">
                                搜 索</button>
                        </div>
                    </div>
                    
                }
            </div>
        </div>
        <div class="ui-box-container-noborder">
            <div class="ui-box-content">
            </div>
        </div>
        <div class="ui-box-container-noborder">
            <div class="tabbable">
                <ul class="nav nav-tabs" style="padding-left: 40px;">
                    <li class="@(Model.Param == 0 ? "active" : string.Empty)"><a href="/item">出售中的商品</a></li>
                    <li class="@(Model.Param == 1 ? "active" : string.Empty)"><a href="/item?param=1">仓库中的商品</a></li>
                    <li class="@(Model.Param == 3 ? "active" : string.Empty)"><a href="/item?param=3">定时上架的商品</a></li>
                    <li class="@(Model.Param == 2 ? "active" : string.Empty)"><a href="/item?param=2">已删除的商品</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active">
                        <table class="ui-table ui-table-inbox ui-table-alpha">
                            <thead>
                                <tr>
                                    <th style="width: 300px;">
                                        商品信息
                                    </th>
                                    <th>
                                        单价(元)
                                    </th>
                                    <th>
                                        库 存
                                    </th>
                                    <th>
                                        总销量
                                    </th>
                                    <th>
                                        上架时间
                                    </th>
                                    <th>
                                        操 作
                                    </th>
                                </tr>
                            </thead>
                            @Model.Items.Each(@<tbody>
                                <tr class="item-header">
                                    <td colspan="2" class="text-align-left">
                                        <label class="checkbox-inline">
                                            <input type="checkbox" value="@(item.Item.Id)"/>
                                            <span>商家编码：@(item.Item.OuterId)</span></label>
                                    </td>
                                    <td colspan="3">
                                        <span>收藏：@(item.Item.Collection)</span> <span>咨询：@(item.Item.Consultation)</span>
                                        <span>评论：@(item.Item.Commentation)</span>
                                    </td>
                                    <td>
                                        dd
                                    </td>
                                </tr>
                                <tr>
                                    <td title="@(item.Item.Name)">
                                        <div class="media">
                                            <a class="pull-left" href="@(string.Format("{0}/{1}.html", WebSite.Item, item.Item.Id))" target="_blank">
                                                <img class="media-object"  src="@item.Item.Picture(ProductItemImageSize.XS)" alt="@(item.Item.Name)" />
                                            </a>
                                            <div class="media-body">
                                                <h5 class="media-heading">
                                                    <span id="item-name-@(item.Item.Id)">@(item.Item.Name)</span> <a title="修改名称" href="/item/name/@(item.Item.Id)" class="edit" data-toggle="modal" data-target="#modal">
                                                        <i class="fa fa-pencil"></i>&nbsp;</a>
                                                </h5>
                                                <div id="item-name-sub-@(item.Item.Id)">@(item.Item.SubName)
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <span id="item-price-@(item.Item.Id)">
                                            @(item.Item.Price.ToString("N"))</span> <a title="修改价格" href="/item/price/@(item.Item.Id)"
                                                                                                          class="edit" data-toggle="modal" data-target="#modal">
                                                <i class="fa fa-pencil"></i>&nbsp;</a>
                                    </td>
                                    <td>
                                        <span id="item-quantity-@(item.Item.Id)">
                                            @item.Item.Quantity</span> <a title="修改库存" href="/item/quantity/@(item.Item.Id)" class="edit" data-toggle="modal" data-target="#modal">
                                                <i class="fa fa-pencil"></i>&nbsp;</a>
                                    </td>
                                    <td>
                                        @item.Item.Sale
                                    </td>
                                    <td>
                                        <span>@(item.Item.OnlineTime.ToString("yyyy-MM-dd"))</span>
                                        <br />
                                        <span>@(item.Item.OnlineTime.ToString("HH:mm:ss"))</span>
                                    </td>
                                    <td>
                                        <a title="生成拍品" href="/auction/create/@(item.Item.Id)" class="list-item-extra-action" target="_blank">
                                            <i class="fa fa-gavel"></i>&nbsp;生成拍品</a><br />
                                        
                                    </td>
                                </tr>
                                <tr class="item-footer">
                                    <td colspan="6">
                                    </td>
                                </tr>
                            </tbody>)
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<style type="text/css">
    .ui-table-alpha tbody tr a.edit { text-decoration: none; margin-left: 10px; }
    .ui-table-alpha tbody a.edit:hover { text-decoration: none; }
    a.list-item-extra-option { color: #777; text-decoration: none; margin-right: 5px; }
    a.list-item-extra-option:hover { color: #444; text-decoration: none; }
    a.list-item-extra-action { text-decoration: none; color: #f40; }
    a.list-item-extra-action:hover { text-decoration: none; }
</style>
@section js{
    <script type="text/javascript">
        function editPrice(id, obj) {
            var action = "";
            var param = {};
            $.postJSON(action, param, function (result) {

            });
        }

        $(function () {
            $('select').select2();
            $('[data-rel="popover"]').popover();
            $('#modal').on('hidden.bs.modal', function () {
                $(this).empty().removeData('bs.modal');
            });
        });

    </script>
}
